import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  // 添加 @ 别名
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
  proxy: {
    '/' : {
      target: 'http://127.0.0.1:3000/',
      secure: false,
      changeOrigin: true, // 是否跨域
      ws:true,
      // rewrite: (path) => path.replace('/api','')
      // pathRewrite: {
      //   '^/api': ''
      // }
    }
  }
})
